package com.ruoyi.supervise.service.impl.decisupport;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.supervise.domain.decisupport.QueryProjectBaseAllProHoursPro;
import com.ruoyi.supervise.mapper.decisupport.QueryProjectBaseAllProHoursProMapper;
import com.ruoyi.supervise.service.decisupport.QueryProjectBaseAllProHoursProService;

@Service
@DataSource(value = DataSourceType.SLAVE)
public class QueryProjectBaseAllProHoursProServiceImpl implements QueryProjectBaseAllProHoursProService{

    @Autowired
    private QueryProjectBaseAllProHoursProMapper queryProjectBaseAllProHoursProMapper;

	@Override
	public List<QueryProjectBaseAllProHoursPro> selectAllPro() {
		// TODO Auto-generated method stub
		return queryProjectBaseAllProHoursProMapper.selectAllPro();
	}

	@Override
	public List<QueryProjectBaseAllProHoursPro> selectAllRE() {
		// TODO Auto-generated method stub
		return queryProjectBaseAllProHoursProMapper.selectAllRE();
	}

	@Override
	public List<QueryProjectBaseAllProHoursPro> selectAllRESP() {
		// TODO Auto-generated method stub
		return queryProjectBaseAllProHoursProMapper.selectAllRESP();
	}

	@Override
	public List<QueryProjectBaseAllProHoursPro> selectAllREBZ() {
		// TODO Auto-generated method stub
		return queryProjectBaseAllProHoursProMapper.selectAllREBZ();
	}

	@Override
	public List<QueryProjectBaseAllProHoursPro> selectAllProAndEB() {
		List<QueryProjectBaseAllProHoursPro> allPro=queryProjectBaseAllProHoursProMapper.selectAllPro();
		List<QueryProjectBaseAllProHoursPro> allRE=queryProjectBaseAllProHoursProMapper.selectAllRE();
		List<QueryProjectBaseAllProHoursPro> allREBZ=queryProjectBaseAllProHoursProMapper.selectAllREBZ();
		List<QueryProjectBaseAllProHoursPro> allRESP=queryProjectBaseAllProHoursProMapper.selectAllRESP();
		for(QueryProjectBaseAllProHoursPro pro:allPro)
		{
			for(QueryProjectBaseAllProHoursPro re:allRE)
			{
				if(re.getAreaNameRE().equals(pro.getAreaName()))
				{
					pro.setComparedTotalAreaRE(re.getComparedTotalAreaRE());
					pro.setTotalAreaRE(re.getTotalAreaRE());
				}
			}
			for(QueryProjectBaseAllProHoursPro rebz:allREBZ)
			{
				if(rebz.getAreaNameREBZ().equals(pro.getAreaName()))
				{
					pro.setComparedTotalAreaREBZ(rebz.getComparedTotalAreaREBZ());
					pro.setTotalAreaREBZ(rebz.getTotalAreaREBZ());
				}
			}
			for(QueryProjectBaseAllProHoursPro resp:allRESP)
			{
				if(resp.getAreaNameRESP().equals(pro.getAreaName()))
				{
					pro.setComparedTotalAreaRESP(resp.getComparedTotalAreaRESP());
					pro.setTotalAreaRESP(resp.getTotalAreaRESP());
				}
			}
		}
		return allPro;
	}

	@Override
	public QueryProjectBaseAllProHoursPro selectAllProProvince() {
		// TODO Auto-generated method stub
		return queryProjectBaseAllProHoursProMapper.selectAllProProvince();
	}

	@Override
	public QueryProjectBaseAllProHoursPro selectAllREProvince() {
		// TODO Auto-generated method stub
		return queryProjectBaseAllProHoursProMapper.selectAllREProvince();
	}

	@Override
	public QueryProjectBaseAllProHoursPro selectAllRESPProvince() {
		// TODO Auto-generated method stub
		return queryProjectBaseAllProHoursProMapper.selectAllRESPProvince();
	}

	@Override
	public QueryProjectBaseAllProHoursPro selectAllREBZProvince() {
		// TODO Auto-generated method stub
		return queryProjectBaseAllProHoursProMapper.selectAllREBZProvince();
	}

	@Override
	public QueryProjectBaseAllProHoursPro selectAllProAndEBProvince() {
		QueryProjectBaseAllProHoursPro allProProvince=queryProjectBaseAllProHoursProMapper.selectAllProProvince();
		QueryProjectBaseAllProHoursPro allREProvince=queryProjectBaseAllProHoursProMapper.selectAllREProvince();
		QueryProjectBaseAllProHoursPro allREBZProvince=queryProjectBaseAllProHoursProMapper.selectAllREBZProvince();
		QueryProjectBaseAllProHoursPro allRESPProvince=queryProjectBaseAllProHoursProMapper.selectAllRESPProvince();
		allProProvince.setComparedTotalAreaRE(allREProvince.getComparedTotalAreaRE());
		allProProvince.setTotalAreaRE(allREProvince.getTotalAreaRE());
		allProProvince.setComparedTotalAreaREBZ(allREBZProvince.getComparedTotalAreaREBZ());
		allProProvince.setTotalAreaREBZ(allREBZProvince.getTotalAreaREBZ());
		allProProvince.setComparedTotalAreaRESP(allRESPProvince.getComparedTotalAreaRESP());
		allProProvince.setTotalAreaRESP(allRESPProvince.getTotalAreaRESP());
		return allProProvince;
	}

}
